{% extends 'forum_list.html' %}
{% load humanize %}
{% load forum_tags %}
{% load static %}
{% load cache %}

{% block title %}Biostar Planet{% endblock %}

{% block css %}
    <style>
        .ui.list .list > .item a.header, .ui.list > .item a.header {
            color: red;
            font-size: larger;
            padding: 1ex 0ex 1ex 0ex;
        }

        .ui.divided.list > .item {
            padding: 2ex 0ex 2ex 0ex !important;
        }

        .ui.list .list > .item > .content, .ui.list > .item > .content {
            line-height: 1.4285em;
        }

        .byline {
            padding-top: 1ex;
        }
    </style>

{% endblock %}


{% block body %}

    <div class="ui page-bar segment">
        {% pages objs=blogposts %}
    </div>


    <div class="ui middle aligned divided relaxed list blog">
        {% for post in blogposts %}

            <div class="item">

                <img class="ui avatar image" src="{% planet_gravatar planet_author=post.blog.title %}">

                <div class="content">
                    {% if post.blog.remote %}
                        <a class="header" href="{% url "blog_view" post.id %}">{{ post.title }}</a>
                    {% else %}
                        <a class="header" href="{{ post.link }}">{{ post.title }}</a>
                    {% endif %}
                </div>
                <div>

                    <div class="content">
                        {{ post.content|truncatewords:80 }}
                        <a href="{{ post.link }}">go to blog</a>
                        {% if user.profile.is_moderator %}
                            &bull; <a class="muted" href="{% url "blog_bump" post.id %}">mod bump</a>
                        {% endif %}
                    </div>
                </div>

                <div class="right floated content">
                    <div class="description byline">
                        posted <!-- {{ post.creation_date|timesince }} ago -->on
                        <a href="{{ post.blog.link }}">{{ post.blog.title|safe }}</a>
                    </div>
                </div>


            </div>
        {% endfor %}
    </div>

    <div class="ui page-bar segment">
        {% pages objs=blogposts %}
    </div>

{% endblock %}

{% block sidebar %}

    <h4>Planet Feeds</h4>

    {% for blog in blogs %}
        <div class="blog-feed">
            <h5><a href="{{ blog.link }}">{{ blog.title }}</a></h5>
            <div>{{ blog.desc|safe }}</div>
            <div class="muted">{{ blog.count }} post{{ blog.count|pluralize }} - last
                updated {{ blog.updated_date|timesince }} ago
            </div>
        </div>
        <div class="ui divider"></div>
    {% endfor %}



{% endblock %}